<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>文档分词</title>
<link href="../../../theme/style.css" rel="stylesheet" type="text/css" />
<script src="../../../theme/jquery.js" type="text/javascript"></script>
<script src="../../../theme/wscui.js" type="text/javascript"></script>
<script src="../../../theme/style.js" type="text/javascript"></script>
</head>
<body>
<div catalog-feed class="grammar">
	<h1>seg</h1>
	<label class="format">
		<span class="t">mixed</span> <span class="t">array</span> <span class="f">seg</span>(<span class="t">string</span> <span class="v">$param</span> [, <span class="t">string</span> <span class="v">$mode</span> = '<span class="S">MAX</span>'])
	</label>
	<div class="intro">
		将指定内容分解成若干个词汇，
		并以数组形式返回各个词在文档中的词性、词频、权重基数。<br />
		分词过程，完全依存于词典；
		系统会自动将源文分解成若干个词汇分别和词典进行比对，
		当分解后的词汇存在于词典中，将被记录以返回。源文越长，用时也越多；
		<div class="br"></div>
		支持：纯文本、HTML文档<br />
		推荐：用<a href="http://www.redis.com" target="_blank">Redis</a>分词(快)
		<div class="br"></div>
		源文：中国人<br />
		结果：中国、中国人 (MAX最大分法)<br />
		结果：中国人 (MIN最小分法)
	</div>
	<div class="return">
		<div class="how">
			<pre><span class="t">return</span> <span class="t">array</span>(
	... 
	...
	<span class="k">1e24cf708a14ce81</span> => <span class="t">array</span>(
		<span class="k">word</span> 		=> <span class="s">测试</span>, 					<span class="c">// 词汇内容</span>
		<span class="k">hash</span> 		=> <span class="s">1e24cf708a14ce81</span>, 		<span class="c">// 词汇MD5码的中间16个字符</span>
		<span class="k">times</span> 		=> <span class="i">3</span>, 						<span class="c">// 词频(在整个文档中出现次数)</span>
		<span class="k">weight</span> 	=> <span class="i">4.720000</span>, 				<span class="c">// 权重基数</span>
	), 
	... 
	...
);</pre>
		</div>
	</div>
	<div class="param">
		<h3>$param</h3>
		<ul>
			<li>
				<span show>string</span>
				<label>待分词的内容/支持HTML</label>
				<div hide class="how">
					<span class="f">M</span>(<span class="s">cws</span>) -> <span class="f">seg</span>(<span class="s">中国人</span>);
				</div>
			</li>
		</ul>
		<h3>$mode</h3>
		<ul>
			<li>
				<span show>MAX</span>
				<label>默认, 最大分法</label>
				<div hide class="how">
					<span class="c">// 返回: 中国、中国人</span><br />
					<span class="f">M</span>(<span class="s">cws</span>) -> <span class="f">seg</span>(<span class="s">中国人</span>);<br />
					<span class="f">M</span>(<span class="s">cws</span>) -> <span class="f">seg</span>(<span class="s">中国人</span>, <span class="s">MAX</span>);
				</div>
			</li>
			<li>
				<span show>MIN</span>
				<label>最小分法</label>
				<div hide class="how">
					<span class="c">// 返回: 中国人</span><br />
					<span class="f">M</span>(<span class="s">cws</span>) -> <span class="f">seg</span>(<span class="s">中国人</span>, <span class="s">MIN</span>);
				</div>
			</li>
		</ul>
	</div>
</div>
</body>
</html>

